package com.wn.consumer04;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author yellow Docter
 * @date 2023 -02-28
 * @desc
 */
@Component
@Slf4j
public class C2Consumer {

    /**
     *   01 监听队列
     *   02 绑定  交换机和 队列
     *   03 写路由规则
     *
     * @param msg
     */
    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(name="Q2"),
            exchange = @Exchange(
                    name = "exchange-topic",
                    type = ExchangeTypes.TOPIC
            ),
            key = {"*.*.rabbit","lazy.#"}
    ))
    public void handlerMsg(String msg){
        log.info("C2Consumer消费者消费了:===>{}",msg);
    }

}
